package com.cxh.mchat.common.utils;

import cn.hutool.core.date.format.FastDateFormat;

import java.util.Date;

/**
 * @author cxh
 * @date 2021/12/28 19:54
 **/
public class DateUtil extends cn.hutool.core.date.DateUtil {

    public static final String NORMA_TIME_CH_PATTERN = "hh:mm";
    public static final FastDateFormat NORMA_TIME_CH_FORMAT = FastDateFormat.getInstance(NORMA_TIME_CH_PATTERN);

    public static String formatChineseTime(Date date) {
        if (null == date) {
            return null;
        }
        String ft = NORMA_TIME_CH_FORMAT.format(date);
        if(isAM(date)){
           return ft.concat(" AM");
        }
        return ft.concat(" PM");
    }
}
